/* ===== Modern visual refactor for legacy homepage (content-preserving) ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f5f7fb;
  --bg-accent: radial-gradient(circle at 10% 10%, rgba(59,130,246,0.10), transparent 45%),
               radial-gradient(circle at 90% 20%, rgba(99,102,241,0.10), transparent 40%),
               radial-gradient(circle at 50% 100%, rgba(14,165,233,0.10), transparent 35%);
  --panel: #f7fbff;
  --panel-strong: #fbfdff;
  --text: #0f172a;
  --muted: #475569;
  --border: rgba(15,23,42,0.10);
  --border-strong: rgba(15,23,42,0.16);
  --shadow: 0 14px 34px rgba(15,23,42,0.08);
  --shadow-soft: 0 10px 26px rgba(15,23,42,0.06);
  --link: #2563eb;
  --link-hover: #1d4ed8;
  --button-grad-1: #2563eb;
  --button-grad-2: #1e40af;
  --hr: linear-gradient(90deg, transparent, rgba(37,99,235,0.25), transparent);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0 !important;
  padding: 10px clamp(12px, 2.6vw, 28px) 28px !important;
  max-width: 1480px;
  margin-inline: auto !important;
  color: var(--text) !important;
  background: var(--bg-accent), var(--bg) !important;
  font-family: 'Inter', 'Nunito', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif !important;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

body[bgcolor], body[text] {
  background: var(--bg-accent), var(--bg) !important;
  color: var(--text) !important;
}

img[src*="linea1.gif"] { display: none !important; }
br + hr, hr + br { display: none; }

table, tr, td {
  margin: 0;
  padding: 0;
  vertical-align: top;
}

a {
  color: var(--link) !important;
  text-decoration: none !important;
  font-weight: 600;
  transition: color .18s ease, opacity .18s ease, transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

a:hover {
  color: var(--link-hover) !important;
  text-decoration: underline !important;
}

a img {
  border: none !important;
  box-shadow: none !important;
  filter: none !important;
  opacity: 1 !important;
  transition: transform .15s ease, box-shadow .18s ease, opacity .18s ease;
}

a:hover img {
  transform: translateY(-1px);
  opacity: 0.95 !important;
}

hr {
  border: 0;
  height: 1px;
  margin: 18px 0 20px;
  background: var(--hr);
}
body > p:empty { display: none; }

/* ===== HERO (first big table) ===== */
body > table:first-of-type {
  width: 100% !important;
  display: block;
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,0.92), #ffffff);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
  backdrop-filter: blur(8px);
}

body > table:first-of-type > tbody {
  display: block;
  width: 100%;
  padding: 12px;
}

body > table:first-of-type > tbody > tr {
  display: grid;
  grid-template-columns: minmax(205px, 250px) 1fr;
  gap: 12px;
  align-items: start;
}

body > table:first-of-type > tbody > tr + tr {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

body > table:first-of-type > tbody > tr > td {
  display: block;
  width: auto !important;
  max-width: none !important;
}

/* photo */
body > table:first-of-type > tbody > tr:first-child > td:first-child {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: var(--panel-strong);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 7px;
  box-shadow: var(--shadow-soft);
}
body > table:first-of-type > tbody > tr:first-child > td:first-child > img {
  width: min(100%, 195px) !important;
  height: auto;
  border-radius: 11px !important;
  border: 0 !important;
  box-shadow: none !important;
  object-fit: cover;
  background: #ffffff;
}

/* title + interests card */
body > table:first-of-type > tbody > tr:first-child > td:nth-child(2) > table,
body > table:first-of-type > tbody > tr:first-child > td:nth-child(2) > table > tbody,
body > table:first-of-type > tbody > tr:first-child > td:nth-child(2) > table > tbody > tr,
body > table:first-of-type > tbody > tr:first-child > td:nth-child(2) > table > tbody > tr > td {
  display: block;
  width: 100%;
}
body > table:first-of-type > tbody > tr:first-child > td:nth-child(2) > table > tbody > tr > td {
  min-height: 136px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 10px 14px !important;
  text-align: left !important;
  box-shadow: var(--shadow-soft);
  font-size: 1rem;
  color: var(--text);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

h1 {
  font-size: clamp(1.24rem, 2.15vw, 1.84rem) !important;
  margin-bottom: 6px !important;
  line-height: 1.1;
}

h2 {
  font-size: clamp(1.05rem, 1.7vw, 1.36rem);
  margin: 24px 0 10px !important;
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  color: #1e40af;
  background: rgba(37,99,235,0.10);
  border: 1px solid rgba(37,99,235,0.18);
  box-shadow: 0 6px 16px rgba(15,23,42,0.05);
}

h3 {
  font-size: clamp(1rem, 1.45vw, 1.28rem);
  margin: 18px 0 8px !important;
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  color: #1e40af;
  background: rgba(37,99,235,0.08);
  border: 1px solid rgba(37,99,235,0.16);
}

h4 {
  font-size: clamp(0.93rem, 1.15vw, 1.04rem);
  margin: 14px 0 10px !important;
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(15,23,42,0.04);
  border: 1px solid rgba(15,23,42,0.10);
}

/* row 2 cards */
body > table:first-of-type > tbody > tr:nth-child(2) {
  align-items: stretch !important;
}
body > table:first-of-type > tbody > tr:nth-child(2) > td:first-child,
body > table:first-of-type > tbody > tr:nth-child(2) > td:nth-child(2) {
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: var(--shadow-soft);
}

body > table:first-of-type table { width: 100%; }
body > table:first-of-type > tbody > tr:nth-child(2) > td:first-child table {
  border-collapse: separate;
  border-spacing: 0;
  height: 100%;
}
body > table:first-of-type > tbody > tr:nth-child(2) > td:first-child table tr:first-child td {
  padding-bottom: 6px;
  vertical-align: top;
}
body > table:first-of-type > tbody > tr:nth-child(2) > td:first-child h3 {
  margin-top: 0 !important;
  margin-bottom: 4px !important;
}

/* socials */
body > table:first-of-type > tbody > tr:nth-child(2) > td:first-child table tr:nth-child(2) td {
  padding: 6px 6px 0 0 !important;
}
body > table:first-of-type > tbody > tr:nth-child(2) > td:first-child a img {
  width: 31px !important;
  height: 31px !important;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  object-fit: contain;
}

/* profile keywords */
.profile-keywords {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.profile-keywords > div {
  position: relative;
  display: block;
  padding-left: 14px;
  border-radius: 10px;
  line-height: 1.22;
  transition: background .15s ease, color .15s ease;
}
.profile-keywords > div::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(15,23,42,0.28);
}
.profile-keywords > div:hover {
  background: rgba(37,99,235,0.06);
  color: var(--link-hover);
}
.profile-keywords > div:hover::before {
  background: linear-gradient(135deg, var(--button-grad-1), var(--button-grad-2));
}

/* list cards */
body > ul {
  list-style: none !important;
  padding-left: 0 !important;
  margin: 10px 0 18px 0 !important;
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
}
body > ul > li {
  position: relative;
  padding: 12px 14px 12px 34px !important;
  margin: 10px 0 !important;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--panel-strong);
  box-shadow: var(--shadow-soft);
}
body > ul > li::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(15,23,42,0.28);
}
body > ul > li:hover::before {
  background: linear-gradient(135deg, var(--button-grad-1), var(--button-grad-2));
}

/* top links and utility */
body > h2, body > h3, body > h4, body > a[name] { scroll-margin-top: 18px; }
body > h3 + ul, body > h4 + ul, body > h2 + ul { margin-top: 8px !important; }
a[href*="#top"] {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.70);
  box-shadow: var(--shadow-soft);
  text-decoration: none !important;
}
a[href*="#top"]:hover { transform: translateY(-1px); text-decoration: none !important; }
img[src*="pdf.png"], img[src*="download.jpg"] { width: 18px !important; height: 18px !important; border-radius: 4px; vertical-align: middle; }
div[align="left"][style*="FONT-SIZE"] {
  margin-top: 18px !important;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  color: var(--muted);
  background: rgba(255,255,255,0.45);
}

/* interest columns + chips */
.ri-columns {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 20px;
  margin-top: 4px;
}
.ri-col { min-width: 0; }
.ri-col .ri-group { margin-top: 4px; }

/* label pills: softer and title case only */
body > table:first-of-type > tbody > tr:first-child > td:nth-child(2) b {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: #294fb8;
  background: rgba(37,99,235,0.08);
  border: 1px solid rgba(37,99,235,0.16);
  padding: 6px 12px;
  border-radius: 999px;
  margin: 2px 0 8px 0;
  box-shadow: 0 4px 12px rgba(15,23,42,0.04);
}

.ri-tags {
  margin-top: 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  line-height: 1.2;
}
.ri-tags .tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15,23,42,0.045);
  border: 1px solid rgba(15,23,42,0.08);
  color: var(--text);
  transition: color .15s ease, background .15s ease, border-color .15s ease, transform .15s ease;
  text-decoration: none !important;
}
.ri-tags .tag + .tag::before { content: none; }
.ri-tags .tag:hover {
  color: var(--link-hover);
  background: rgba(37,99,235,0.08);
  border-color: rgba(37,99,235,0.16);
  transform: translateY(-1px);
  text-decoration: none !important;
}

.sep::before { content: " · "; color: var(--muted); opacity: 0.9; font-weight: 600; }

/* ===== DESKTOP NAV DOCK ===== */
body > table:first-of-type > tbody > tr:nth-child(2) > td:nth-child(2) {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}

.hero-links-grid {
  position: relative;
  width: min(100%, 640px);
  display: grid;
  grid-template-columns: repeat(5, minmax(88px, 1fr));
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(37,99,235,0.05), rgba(37,99,235,0.02));
  border: 1px solid rgba(37,99,235,0.10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

.hero-link,
.hero-link-wide,
.hero-link-full {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--button-grad-1), var(--button-grad-2));
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 10px 24px rgba(37,99,235,0.18);
  color: #fff !important;
  text-decoration: none !important;
  overflow: visible;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.hero-link:hover,
.hero-link:focus-visible {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 16px 30px rgba(37,99,235,0.28);
  filter: brightness(1.04);
  text-decoration: none !important;
  outline: none;
  z-index: 2;
}
.hero-link .material-icons {
  font-size: 28px;
  line-height: 1;
  color: #fff !important;
  transition: transform .18s ease, opacity .18s ease;
}
.hero-link span {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(6px);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(15,23,42,0.92);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 12px 24px rgba(15,23,42,0.18);
  transition: opacity .18s ease, transform .18s ease;
}
.hero-link span::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(15,23,42,0.92);
}
.hero-link:hover span,
.hero-link:focus-visible span {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.hero-link:hover .material-icons,
.hero-link:focus-visible .material-icons {
  transform: scale(1.05);
}

/* ===== MOBILE / TABLET ===== */
@media (max-width: 980px) {
  body {
    padding-top: 12px !important;
  }
  body > table:first-of-type {
    border-radius: 18px;
  }
  body > table:first-of-type > tbody {
    padding: 10px;
  }
  body > table:first-of-type > tbody > tr {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  body > table:first-of-type > tbody > tr:first-child > td:first-child {
    justify-content: center;
  }
  body > table:first-of-type > tbody > tr:first-child > td:first-child > img {
    width: min(62vw, 220px) !important;
  }
  body > table:first-of-type > tbody > tr:first-child > td:nth-child(2) > table > tbody > tr > td {
    min-height: auto;
    text-align: left !important;
    padding: 10px 12px !important;
  }
  h1 { text-align: left !important; }
  body > table:first-of-type > tbody > tr:first-child > td:nth-child(2) b { align-self: flex-start; }
  .ri-columns { grid-template-columns: 1fr; gap: 12px; }
  body > table:first-of-type > tbody > tr:nth-child(2) > td:first-child a img {
    width: 30px !important; height: 30px !important;
  }
  .hero-links-grid {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
  }
  .hero-link,
  .hero-link-wide,
  .hero-link-full {
    aspect-ratio: auto;
    min-height: 58px;
    padding: 0 14px;
    border-radius: 14px;
    justify-content: flex-start;
    gap: 10px;
  }
  .hero-link-full { grid-column: 1 / -1; }
  .hero-link .material-icons { font-size: 20px; }
  .hero-link span {
    position: static;
    transform: none;
    opacity: 1;
    pointer-events: auto;
    white-space: normal;
    padding: 0;
    border-radius: 0;
    background: none;
    color: #fff;
    font-size: 14px;
    line-height: 1.15;
    box-shadow: none;
  }
  .hero-link span::after { content: none; }
  .hero-link:hover,
  .hero-link:focus-visible,
  .hero-link-full:hover,
  .hero-link-full:focus-visible {
    transform: translateY(-2px);
  }
}

/* portrait phones */
@media (max-width: 700px) {
  .hero-links-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  body { padding-inline: 10px !important; }
  h1 { line-height: 1.12; }
}

@media print {
  body {
    background: #fff !important;
    color: #000 !important;
    max-width: none;
    padding: 0 !important;
  }
  .hero-links-grid,
  a[href*="#top"],
  .material-icons { display: none !important; }
  body > table:first-of-type,
  body > ul {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    background: #fff !important;
  }
}

html, body { color-scheme: light !important; }


/* ===== TOUCH DEVICES: disable sticky hover / icon shift ===== */
@media (hover: none), (pointer: coarse) {
  .hero-links-grid {
    width: 100% !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    padding: 0 !important;
    background: none !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  .hero-link,
  .hero-link-wide,
  .hero-link-full {
    aspect-ratio: auto !important;
    min-height: 58px !important;
    padding: 0 14px !important;
    border-radius: 14px !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    transform: none !important;
    transition: box-shadow .18s ease, filter .18s ease !important;
    -webkit-tap-highlight-color: transparent;
  }

  .hero-link-full {
    grid-column: 1 / -1 !important;
  }

  .hero-link .material-icons {
    font-size: 20px !important;
    transform: none !important;
    transition: none !important;
  }

  .hero-link span {
    position: static !important;
    transform: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    white-space: normal !important;
    padding: 0 !important;
    border-radius: 0 !important;
    background: none !important;
    color: #fff !important;
    font-size: 14px !important;
    line-height: 1.15 !important;
    box-shadow: none !important;
  }

  .hero-link span::after {
    content: none !important;
  }

  .hero-link:hover,
  .hero-link:focus,
  .hero-link:focus-visible,
  .hero-link:active,
  .hero-link-full:hover,
  .hero-link-full:focus,
  .hero-link-full:focus-visible,
  .hero-link-full:active {
    transform: none !important;
    filter: none !important;
    box-shadow: 0 10px 24px rgba(37,99,235,0.18) !important;
    outline: none !important;
  }
}

/* narrow portrait phones */
@media (hover: none) and (pointer: coarse) and (max-width: 700px),
       (pointer: coarse) and (max-width: 700px) {
  .hero-links-grid {
    grid-template-columns: 1fr !important;
  }

  .hero-link-full {
    grid-column: auto !important;
  }
}
